package edu.study.common.retry;

import lombok.AllArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

@AllArgsConstructor
public class SameIntervalPolicy implements RetryPolicy {
    
    private long intervalM = 1000 * 60 * 5;

    public SameIntervalPolicy() {}

    @Override
    public Date nextRetryDate(Date now, int alreadyTryTimes) {
        long next = now.getTime() + intervalM;

        return new Date(next);
    }

    @Override
    public Date nextRetryDate(Date now, int alreadyTryTimes, long baseInterval) {
        long next = now.getTime() + baseInterval;

        return new Date(next);
    }

    @Override
    public Date nextRetryDate(Date now, int alreadyTryTimes, long baseInterval, BigDecimal basePow) {
        long next = now.getTime() + baseInterval;

        return new Date(next);
    }
}
